package com.swz.dcrm.adpter;

import android.content.Context;

import com.swz.dcrm.R;
import com.swz.dcrm.base.ViewHolder;
import com.swz.dcrm.model.Schedule;
import com.swz.dcrm.util.DateUtils;


import java.util.List;

public class ScheduleAdapter extends CustomAdapter<Schedule> {

    public ScheduleAdapter(Context context,  List<Schedule> datas) {
        super(context, R.layout.item_schedule, datas);
    }

    @Override
    protected void convert(ViewHolder holder, Schedule schedule, int position) {
        holder.setText(R.id.tv_title,schedule.getContext());
        holder.setText(R.id.tv_time, DateUtils.dateFormat(schedule.getStartTime(),"HH:mm")+
                "-"+DateUtils.dateFormat(schedule.getEndTime(),"HH:mm"));
        holder.itemView.setOnClickListener(v -> {
            if(onClickListener!=null){
                onClickListener.onItemClick(schedule);
            }
        });
    }
}
